package com.celesea.auth.position.v1.controller.resource;

import com.celesea.auth.position.entity.Position;
import com.celesea.auth.position.vo.PositionVo;
import com.celesea.auth.position.vo.UserPositionVo;
import com.celesea.framework.util.StringKit;
import com.celesea.framework.vo.DictionaryVo;
import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * ${DESCRIPTION}
 *
 * @author JackYuan
 * @create 2017-10-29 22:21
 */
public class PositionResource {
    private String id;
    private String name;
    private String code;
    private Integer sort;
    private String description;
    protected Byte extend;
    protected Byte bubble;
    private Byte statusFlag;
    // 当 currentDept.id != dept.id 时，界面是不可编辑的
    private DictionaryVo currentDept;

    private DictionaryVo dept;
    private List<UserPositionVo> users;

    public PositionResource(PositionVo vo) {
        BeanUtils.copyProperties(vo, this);
    }

    public PositionResource(Position vo) {
        BeanUtils.copyProperties(vo, this);
        if (StringKit.isNotEmpty(vo.getDeptId())) {
            this.dept = new DictionaryVo(vo.getDeptId(), vo.getDeptName());
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public DictionaryVo getDept() {
        return dept;
    }

    public void setDept(DictionaryVo dept) {
        this.dept = dept;
    }

    public Byte getExtend() {
        return extend;
    }

    public void setExtend(Byte extend) {
        this.extend = extend;
    }

    public Byte getBubble() {
        return bubble;
    }

    public void setBubble(Byte bubble) {
        this.bubble = bubble;
    }

    public Byte getStatusFlag() {
        return statusFlag;
    }

    public void setStatusFlag(Byte statusFlag) {
        this.statusFlag = statusFlag;
    }

    public List<UserPositionVo> getUsers() {
        return users;
    }

    public void setUsers(List<UserPositionVo> users) {
        this.users = users;
    }

    public DictionaryVo getCurrentDept() {
        return currentDept;
    }

    public void setCurrentDept(DictionaryVo currentDept) {
        this.currentDept = currentDept;
    }
}
